package com.fr.web.face;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.privilege.AbstractPrivilege;
import com.fr.privilege.authority.Authority;

public abstract class AbstractNodeDef extends AbstractPrivilege
  implements NodeDef
{
  private String name;

  public String getName()
  {
    return this.name;
  }

  public void setName(String paramString)
  {
    this.name = paramString;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str;
      if ("Attributes".equals(paramXMLableReader.getTagName()))
        if ((str = paramXMLableReader.getAttr("name")) != null)
          setName(str);
      else if ("RoleNames".equals(paramXMLableReader.getTagName()))
        if ((str = paramXMLableReader.getElementValue()) != null)
        {
          String[] arrayOfString = str.split(".,;");
          if ((arrayOfString != null) && (arrayOfString.length > 0))
          {
            int i = 0;
            int j = arrayOfString.length;
            while (i < j)
            {
              addAuthority(new Authority(arrayOfString[i]));
              ++i;
            }
          }
        }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Attributes");
    if (getName() != null)
      paramXMLPrintWriter.attr("name", getName());
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}